import request from '@/utils/request';
import service from "@/utils/request";

// api接口

// user
export const createUser = (userData) => request.post(`/user/create`, userData);
export const getUserList = () => request.get(`/user/users`);
export const getUserById = (id) => request.get(`/user/users/${id}`);
export const updateUser = (id, userData) => request.put(`/user/users/${id}`, userData);
export const updateUserRole = (id, userData) => request.put(`/user/role/${id}`, userData);
export const deleteUser = (id) => request.delete(`/user/users/${id}`);
export const login = (data) => request.post(`/user/login`, data);

// table
export const createTable = (tableData) => request.post(`/table/create`, tableData);
export const getTableByUserId = (id) => request.get(`/table/tables/${id}`);
export const deleteTable = (id) => request.delete(`/table/tables/${id}`)

// comment
export const createComment = (commentData) => request.post(`/comment/create`, commentData, { timeout: 20000 });
export const getCommentByTableId = (id) => request.get(`/comment/comments/${id}`);